# -*- coding:UTF-8 -*-

if(__name__ == '__main__'):

    psize = 100000
    psize = 10
    ipMap = {}

    ## 读取文件内容
    # for i in range(574):
    for i in range(10):

        file = open("E:\\ip.txt")
        for line in file.readlines()[i * psize: (i+1) * psize]:
            ip = line.replace('\n', '').replace('61.135.210.4/', '')
            if ip in ipMap:
                ipMap[ip] += 1
            else:
                ipMap[ip] = int(1)

        file.close()

        print('从 %s 到 %s' % (i*psize, (i+1)*psize))


    ## 写入文件

    # wFile = open('/home/kaifa/jltest/ip_35_jlqnzs_result.txt', 'w')
    wFile = open('E:\\ip_35_jlqnzs_result.txt', 'w')
    wFile.write(str(ipMap))
    wFile.close()
    print('Done......')